import AddTagComponent from './add_tag/Index.vue';
import axios from '@axios/project';
import { Component, Vue } from 'vue-property-decorator';
import { Project } from '@entity/project';

@Component({
    components: {
        AddTagComponent
    }
})
export class PublishView extends Vue {

    /** 项目 */
    private project: Project = new Project();

    /** 从本地取出自己的信息 */
    created() {
        this.project.master = this.$store.getters.me();
    }

    /**
     * 日期选择器
     */
    private datePickerNow: any = {
        disabledDate (date: any) {
            return date && date.valueOf() < Date.now() - 86400000;
        }
    }

    /**
     * 在职位发生变化时被调用, 获取发布人自己的职位和组员的职位
     */
    private tagsChange(data: any) {
        this.project.masterTag = data.masterTag.tag;
        this.project.positions = data.positions;
    }

    /**
     * 发布
     */
    private doPublish(): void {
        axios.base.publish(this.project);
    }
}